public class test {
    //蓝桥杯 星际旅行(⭐⭐⭐)
    //1. Floyd解法
    public class Main {
        public static long INF = 0x3f3f3f3f3f3f3f3fl;
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int m = in.nextInt();
            int q = in.nextInt();
            long[][] dp = new long[n + 1][n + 1];
            for (int i = 1; i <= n; i++) {
                Arrays.fill(dp[i], INF);
                dp[i][i] = 0;
            }
            for (int i = 1; i <= m; i++) {
                int u = in.nextInt();
                int v = in.nextInt();
                dp[u][v] = 1;
                dp[v][u] = 1;
            }
            for (int k = 1; k <= n; k++) {
                for (int j = 1; j <= n; j++) {
                    for (int i = 1; i <= n; i++) {
                        if(dp[i][k] != INF && dp[k][j] != INF)
                            dp[i][j] = Math.min(dp[i][j], dp[i][k] + dp[k][j]);
                    }
                }
            }
            int ans = 0;
            for (int i = 0; i < q; i++) {
                int start = in.nextInt();
                int end = in.nextInt();
                for (int j = 1; j <= n; j++) {
                    if (dp[start][j] <= end) ans++;
                }
            }
            System.out.printf("%.2f", (1.0 * ans) / q);
        }
    }
}
    //2.bfs做法
public class Main {
    public static int n;
    public static int m;
    public static int sum;
    public static int row;
    public static int col;
    public static int max;
    //星球的邻接表
    public static HashMap<Integer, List<Integer>> Ms;
    //第i个旅游盲盒,起始星球xi和最多可以使用传送门次数yi
    public static HashMap<Integer,int[]> Qs;
    public static int[] dx = {0,0,1,-1};
    public static int[] dy = {1,-1,0,0};
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        m = in.nextInt();
        //记录此次旅行中,某个星球是否旅游过
        int q = in.nextInt();
        Ms = new HashMap<>();
        Qs = new HashMap<>();
        for(int i = 1;i <= m;i++){
            //第i个传送门,链接[a,b].
            int a1 = in.nextInt();
            int a2 = in.nextInt();
            List<Integer> path1 = Ms.getOrDefault(a1,new ArrayList<>());
            path1.add(a2);
            Ms.put(a1,path1);
            List<Integer> path2 = Ms.getOrDefault(a2,new ArrayList<>());
            path2.add(a1);
            Ms.put(a2,path2);
        }
        for(int i = 1;i <= q;i++){
            //第i个盲盒,出发点与传送次数[a,b].
            Qs.put(i,new int[]{in.nextInt(), in.nextInt()});
        }
        for(int i = 1;i <= q;i++){
            bfs(i);
        }
        double x = 1.0 * sum / q;
        System.out.printf("%.2f",x);
    }
    //盲盒
    public static void bfs(int index) {
        //此次旅行的最大传送次数
        int max = Qs.get(index)[1];
        boolean[] count1 = new boolean[n + 5];
        HashMap<Integer, Integer> map = new HashMap<>();
        Queue<Integer> queue = new LinkedList<>();
        //此次盲盒的起点星球
        int start = Qs.get(index)[0];
        count1[start] = true;
        queue.add(start);
        int len = 1;
        while (!queue.isEmpty() && max > 0) {
            int size = queue.size();
            for (int j = 0; j < size; j++) {
                int earth = queue.poll();
                // 1.当前星球存在传送口
                // 2.当前传送门没有进入过
                if (Ms.containsKey(earth)) {
                    List<Integer> path = Ms.get(earth);
                    for (int i = 0; i < path.size(); i++) {
                        int out = path.get(i);
                        if (!count1[out]) {
                            len++;
                            count1[out] = true;
                            queue.add(out);
                        }
                    }
                }
            }
            max--;
        }
        sum += len;
    }
    //蓝桥杯 玩具蛇(⭐⭐⭐)
    public class Main {
        public static int row;
        public static int col;
        public static boolean[][] count;
        public static int[] dx = {0,0,1,-1};
        public static int[] dy = {1,-1,0,0};
        public static int sum;
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            row = 4;
            col = 4;
            count = new boolean[row][col];
            //分别从16个起点开始
            for(int i = 0;i < 4;i++){
                for(int j = 0;j < 4;j++){
                    for(int k = 0;k < row;k++) Arrays.fill(count[k],false);
                    count[i][j] = true;
                    dfs(i,j,1);
                }
            }
            System.out.println(sum);
        }
        public static void dfs(int nx,int ny,int len) {
            if(len == 16){
                sum++;
                return;
            }
            for(int i = 0;i < 4;i++){
                int x = nx + dx[i];
                int y = ny + dy[i];
                if(x >= 0 && x < row && y >= 0 && y < col && !count[x][y]){
                    count[x][y] = true;
                    dfs(x,y,len + 1);
                    count[x][y] = false;
                }
            }
        }
    }
}
